package com.caunock.sqlbuilder;

import com.caunock.sqlbuilder.adapter.DDLAdapter;
import com.caunock.sqlbuilder.adapter.DDLAdapterHolder;
import com.caunock.sqlbuilder.meta.Table;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @PostMapping("/create")
    public String test(@RequestBody Table table) {
        DDLAdapter adapter = DDLAdapterHolder.getAdapter(table.getCatalog());
        StringBuilder builder = new StringBuilder();
        adapter.buildCreate(builder, table);
        return builder.toString();
    }
}
